function HandlePageWageUnverified(gui, operator, now, options) {
  this._gui = gui;
  this._operator = operator;
  this._now = now;
  this._options = options;

  this._createElements();
};

HandlePageWageUnverified.prototype._createElements = function() {
  var _self = this;
  this._popupBox = new PopupBox();
  this._popupBox2 = new PopupBox2();
  
  tr = this._gui.mains.insertRow(-1);
  td = tr.insertCell(-1);
  td.style.backgroundColor = '#fff';
  td.colSpan = 8;
  td.appendChild(DOMUtils.getLoadingImage());
  
  this._loadData();
};

HandlePageWageUnverified.prototype._loadData = function() {
  this._expenses = null;
  this._updateds = null;
  this._parameters = null;
  this._retrieveUpdates();
  this._retrieveExpenses(1);
};

HandlePageWageUnverified.prototype._verifyData = function() {
  if (this._updateds && this._expenses) {
    this._updateElements();
  }
};

HandlePageWageUnverified.prototype._retrieveUpdates = function() {
  var _self = this;
  var cond = 'WHERE e.status = 1 AND (e.particular LIKE \'%Wage%\')';
  var args = 'c=' + cond + '&operator=' + JSON.stringify(this._operator);
  new RequestUtils()._mysql('wageupdated', args, function(result, params) { _self._updateds = result.data;
                                                                            _self._verifyData.call(_self);
                                                                          }, null);
};

HandlePageWageUnverified.prototype._retrieveExpenses = function(page) {
  var _self = this;
  var cond = 'd.status = 0 AND (d.particular LIKE \'%Wage%\')';
  var args = 'c=' + cond + '&p=' + page  + '&s=20';
  new RequestUtils()._custom('acctexpenses', args, function(result, params) { _self._expenses = result.data;
                                                                              _self._parameters = result;
                                                                              _self._verifyData.call(_self);
                                                                            }, null);
};

HandlePageWageUnverified.prototype._updateElements = function() {
  var _self = this, unique = MiscUtils.unique();
  DOMUtils.removeChildElements(this._gui.pagination);
  DOMUtils.removeTableRows(this._gui.mains, 1);
  DOMUtils.removeTableRows(this._gui.table, 1);
  DOMUtils.removeChildElements(this._gui.more);
  DOMUtils.removeChildElements(this._gui.checkAll);
  this._selects = [];
  if (this._updateds.length == 0) {
    tr = this._gui.table.insertRow(-1);
    td = tr.insertCell(-1);
    td.colSpan = 6;
    td.style.height = '25px';
    td.style.backgroundColor = '#ffffff';
    td.style.textAlign = 'center';
    td.style.borderRight = 'solid 1px #b4b4b4';
    td.style.borderLeft = 'solid 1px #b4b4b4';
    td.style.borderBottom = 'solid 1px #b4b4b4';
    td.appendChild(document.createTextNode('N/A'));
  }
  for (var j = 0, jl = this._updateds.length; j < jl; j++) {
    var object = this._updateds[j];
    if (j < 5) {
      tr = this._gui.table.insertRow(-1);
      tr.style.backgroundColor = (j % 2 == 0) ? '#fff' : '#ccc';
      tr.style.height = '24px';
      new TableRowLastUpdatedWage(tr, object, {user: this._user, date: this._date} );
    }
  }
  if (this._updateds.length > 5) {
    var a = document.createElement('a');
    a.appendChild(document.createTextNode('Find all'));
    a.href = '#';
    a.onclick = function() {  var w = window.open('?p=pageasst&t=pagelastupdatedwage', 'Last Updated', 'width=1024,height=768,scrollbars=1,location=0', true);
                              w.focus();
                              return false;
                           };
    this._gui.more.appendChild(a);
  }
  
  
  this._gui.verify.onclick = function() { if (_self._selects.length == 0) {
                                            window.alert('No Items Selected');
                                            return;
                                          }
                                          var exps = []; empty = false;
                                          for (var i = 0, il = _self._selects.length; i <il; i++) {
                                            var exp = _self._selects[i];
                                            if (exp.amount == '') {
                                              empty = true;
                                            } else {
                                              exp.status = 1;
                                              exp.confirmOperator = _self._operator.account;
                                              exp.confirmDate = _self._now;
                                              exps[exps.length] = exp;
                                            }
                                          }
                                          if (empty) {
                                            window.alert('Amount is empty');
                                            return;
                                          }
                                          new RequestUtils()._write('expense', exps, [], function(result,params) { if (result) { _self._retrieveUpdates(); _self._retrieveExpenses(_self._parameters.page, _self._parameters.condition); }; }, { pos: DOMUtils.findPos(this) });
                                        };
  
  if (this._expenses.length == 0) {
    tr = this._gui.mains.insertRow(-1);
    tr.className = 'roweven';
    td = tr.insertCell(-1);
    td.colSpan = 8;
    td.style.height = '24px';
    td.style.textAlign = 'center';
    td.style.borderRight = 'solid 1px #694247';
    td.style.borderBottom = 'solid 1px #694247';
    td.appendChild(document.createTextNode('N/A'));
  }

  for (var i = 0, il = this._expenses.length; i < il; i++) {
    var expense = this._expenses[i];
    tr = this._gui.mains.insertRow(-1);
    tr.className = (tr.rowIndex % 2 == 0) ? 'roweven' : 'rowodd';
    
    td = tr.insertCell(-1);
    td.style.textAlign = 'center';
    td.style.borderRight = 'solid 1px #694247';
    td.style.borderBottom = 'solid 1px #694247';
    var check = DOMUtils.createInput('', unique + '_' + i, 'checkbox', '', null);
    check._expense = expense;
    check.onclick = function() { if (this.checked == true) {
                                   _self._selects[_self._selects.length] = this._expense;
                                 } else {
                                   MiscUtils.remove(_self._selects, this._expense, 'trackId');
                                 }
                               };
    td.appendChild(check);
    
    td = tr.insertCell(-1);
    td.style.height = '25px';
    td.style.textAlign = 'center';
    td.style.borderRight = 'solid 1px #694247';
    td.style.borderBottom = 'solid 1px #694247';
    td.appendChild(document.createTextNode(SimpleDate.format(expense.createdDate)));
    
    td = tr.insertCell(-1);
    td.style.textAlign = 'center';
    td.style.borderRight = 'solid 1px #694247';
    td.style.borderBottom = 'solid 1px #694247';
    td.appendChild(document.createTextNode(SimpleDate.format(expense.payDate)));
    
    td = tr.insertCell(-1);
    td.style.textAlign = 'left';
    td.style.padding = '0 0 0 12px';
    td.style.borderRight = 'solid 1px #694247';
    td.style.borderBottom = 'solid 1px #694247';
    td.appendChild(document.createTextNode(expense.payee));
    
    td = tr.insertCell(-1);
    td.style.textAlign = 'left';
    td.style.padding = '0 0 0 12px';
    td.style.borderRight = 'solid 1px #694247';
    td.style.borderBottom = 'solid 1px #694247';
    td.appendChild(document.createTextNode(expense.particular));
    
    td = tr.insertCell(-1);
    td.style.textAlign = 'center';
    td.style.borderRight = 'solid 1px #694247';
    td.style.borderBottom = 'solid 1px #694247';
    var input = DOMUtils.createInput('', '', 'text', (expense.amount == 0) ? '' : expense.amount, null);
    input.style.borderLeft='solid 1px #d2c4b9';
    input.style.borderTop= 'solid 1px #d2c4b9';
    input.style.borderRight= 'solid 1px #fff';
    input.style.borderBottom= 'solid 1px #fff';
    input.style.width = '75px';
    input._expense = expense;
    input.onchange = function() { this._expense.amount = this.value; };
    td.appendChild(input);

    td = tr.insertCell(-1);
    td.style.textAlign = 'center';
    td.style.borderRight = 'solid 1px #694247';
    td.style.borderBottom = 'solid 1px #694247';
    var input = DOMUtils.createInput('', '', 'text', expense.note, null);
    input.style.width = '245px';
    input.style.borderLeft='solid 1px #d2c4b9';
    input.style.borderTop= 'solid 1px #d2c4b9';
    input.style.borderRight= 'solid 1px #fff';
    input.style.borderBottom= 'solid 1px #fff';
    input._expense = expense;
    input.onchange = function() { this._expense.note = this.value; };
    td.appendChild(input);
    
    td = tr.insertCell(-1);
    td.style.textAlign = 'center'; 
    td.style.borderRight = 'solid 1px #694247';
    td.style.borderBottom = 'solid 1px #694247';
    var remove = document.createElement('img');
    remove.src = 'images/common/delete.png';
    remove.style.cursor = 'pointer';
    remove._expense = expense;
    remove.style.margin = '0 0 0 3px';
    remove.onclick = function() { var pos = DOMUtils.findPos(this);
                                  var div = document.createElement('div');
                                  var expense = this._expense
                                  var func1 = function() { expense.status = -1;
                                                           expense.cancelledDate = _self._now;
                                                           expense.cancelledOperator = _self._operator.account;
                                                           expense.cancelledMessage = expense._text;
                                                           new RequestUtils()._write('expense', [expense], [], function() { _self._retrieveExpenses(1); }, { pos: pos });
                                                           _self._popupBox2._close();
                                                         };
                                  var func2 = function() { _self._popupBox2._close(); };
                                  MiscUtils.dialog(_self._popupBox2, pos, div, func1, func2, {t: 'Cancel Reason'});
                                  new DialogInput(div, expense, { title: '' });
                                  return false;
                                };
    td.appendChild(remove);
  }
  
  this._gui.checkAll.checked = false;
  this._gui.checkAll._unique = unique;
  this._gui.checkAll.onclick = function() { if (this.checked == true) {
                                             for (var i = 0, il = _self._expenses.length; i < il; i++) {
                                                var object = _self._expenses[i];
                                                if (document.getElementById(this._unique + '_' + i)) {
                                                  _self._selects[_self._selects.length] = object;
                                                  document.getElementById(this._unique + '_' + i).checked = true;
                                                }
                                              }
                                            } else {
                                              for (var i = 0, il = _self._expenses.length; i < il; i++) {
                                                var object = _self._expenses[i];
                                                if (document.getElementById(this._unique + '_' + i)) {
                                                  MiscUtils.remove(_self._selects, object, 'trackId');
                                                  document.getElementById(this._unique + '_' + i).checked = false;
                                                }
                                              }
                                            }
                                          };
  
  Pagination.makePagedResults(this._gui.pagination, this._parameters.page, this._parameters.total, this._parameters.size, function(page, condition) { _self._retrieveExpenses.call(_self, page, _self._parameters.condition); }, this, document);
  
};